filter and reduce method